package com.bdqn.ch03.sz.factory;


import com.bdqn.ch03.sz.dao.NumBerDao;
import com.bdqn.ch03.sz.dao.impl.NumBerDaoImpl;
import com.bdqn.ch03.sz.dao.impl.NumBerDivideDaoImpl;
import com.bdqn.ch03.sz.dao.impl.NumBerMultiplicationDaoImpl;
import com.bdqn.ch03.sz.dao.impl.NumBerjianDaoImpl;

public class SimpleDaFactory {

    public  static NumBerDao getSum(String sum){
        switch (sum) {
            case "+":
                return new NumBerDaoImpl();
            case "-":
                return new NumBerjianDaoImpl();
            case "*":
                return new NumBerMultiplicationDaoImpl();
            case "/":
                return new NumBerDivideDaoImpl();
            default:
                throw new IllegalArgumentException("不支持的运算符: " + sum);
        }
    }
}
